$OpenBSD: patch-src_interface_c,v 1.2 2014/01/29 15:22:31 abieber Exp $
--- src/interface.c.orig	Mon Oct 22 18:37:22 2012
+++ src/interface.c	Tue Jan 28 10:19:11 2014
@@ -88,6 +88,15 @@
 
 #include <Xm/XmAll.h>
 
+#ifdef __OpenBSD__
+#include <paths.h>
+#endif
+#ifdef _PATH_UUCPLOCK
+#define        LOCK_DIR        _PATH_UUCPLOCK
+#else
+#define        LOCK_DIR        "/var/lock"
+#endif
+
 #include "xastir.h"
 #include "symbols.h"
 #include "main.h"
@@ -4355,7 +4364,7 @@ int serial_detach(int port) {
         }
 
         // Delete lockfile
-        xastir_snprintf(fn, sizeof(fn), "/var/lock/LCK..%s", get_device_name_only(port_data[port].device_name));
+	xastir_snprintf(fn, sizeof(fn), "%s/LCK..%s", LOCK_DIR, get_device_name_only(port_data[port].device_name));
         if (debug_level & 2)
             fprintf(stderr,"Delete lock file %s\n",fn);
 
@@ -4455,7 +4464,7 @@ int serial_init (int port) {
 
 
     // check for lockfile
-    xastir_snprintf(fn, sizeof(fn), "/var/lock/LCK..%s",
+    xastir_snprintf(fn, sizeof(fn), "%s/LCK..%s", LOCK_DIR,
             get_device_name_only(port_data[port].device_name));
 
     if (filethere(fn) == 1) {
@@ -4632,8 +4641,20 @@ int serial_init (int port) {
         return (-1);
     }
 
+#ifdef NMEADISC
+    if (port_data[port].device_type == DEVICE_SERIAL_GPS) {
+        int ldisc = NMEADISC, ret;
+
+        ENABLE_SETUID_PRIVILEGE;
+        ret = ioctl(port_data[port].channel, TIOCSETD, &ldisc);
+        DISABLE_SETUID_PRIVILEGE;
+        if (ret == -1)
+           fprintf(stderr, "couldn't set nmea discipline on port %d", port);
+    }
+#endif
+
     // Attempt to create the lockfile
-    xastir_snprintf(fn, sizeof(fn), "/var/lock/LCK..%s", get_device_name_only(port_data[port].device_name));
+    xastir_snprintf(fn, sizeof(fn), "%s/LCK..%s", LOCK_DIR, get_device_name_only(port_data[port].device_name));
     if (debug_level & 2)
         fprintf(stderr,"Create lock file %s\n",fn);
 
